// Copyright 2023 Leo <lipf160627@163.com>. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.

package model

import (
	"github.com/go-playground/validator/v10"
)

type UpdateRequest struct {
	OperatorID uint        `json:"operator-id" validate:"required"`
	ID         uint        `json:"id" validate:"required"`
	NickName   string      `json:"nickName"`
	Address    UserAddress `json:"address"`
	Telephone  string      `json:"telephone"`
	Birthday   int64       `json:"birthday"`
	// NickName    string `json:"nickName"`    // 用户昵称
	// SideMode    string `json:"sideMode"`    // 用户侧边主题
	// HeaderImg   string `json:"headerImg"`   // 用户头像
	// BaseColor   string `json:"baseColor"`   // 基础颜色
	// ActiveColor string `json:"activeColor"` // 活跃颜色
	// AuthorityId string `json:"authorityId"`
}

type UpdateResponse struct {
	Message string `json:"message" validate:"required"`
}

type ChangePasswordRequest struct {
	OperatorID  uint   `json:"operatorId" validate:"required"`
	ID          uint   `json:"id" validate:"required"`
	Password    string `json:"password" validate:"required,min=6,max=16"`
	PasswordNew string `json:"passwordNew" validate:"required,min=6,max=16,eqfield=Password"`
}

type ChangePasswordResponse struct {
	Message string `json:"message" validate:"required"`
}

func (r *UpdateRequest) Validate(v *validator.Validate) error {
	return v.Struct(r)
}

func (r *UpdateResponse) Validate(v *validator.Validate) error {
	return v.Struct(r)
}

func (r *ChangePasswordRequest) Validate(v *validator.Validate) error {
	return v.Struct(r)
}

func (r *ChangePasswordResponse) Validate(v *validator.Validate) error {
	return v.Struct(r)
}
